package net.vkits;

import net.vkits.auth.application.UserApplicationService;
import net.vkits.auth.domain.model.User;
import net.vkits.auth.domain.repository.UserRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import javax.annotation.Resource;

/**
 * Created by ethan-liu on 16/3/31.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ConfBackendApplication.class)
@WebAppConfiguration
public class addTestUser {
    @Resource
    private UserRepository userRepository;

    @Resource
    private UserApplicationService userApplicationService;

    @Test
    public void createUserAndPermission() {
        final User user = new User("test","123456");
        userRepository.save(user);
    }

    @Test
    public void setAdminUser() {
        userApplicationService.setAdminUser("ethan");
    }
}
